#include <iostream>
using namespace std;
int main() {
    int c = 0, e = 0;
    int m = 0;
    while(m < 12) {
        int x;
        cin >> x;
        int t = 300 + c - x;
        m++;
        if(t < 0) {
            cout << -m << endl;
            return 0;
        }
        e += (t / 100) * 100;
        c = (t % 100);
    }
    cout << e + (int)e * 0.2 + c<< endl;
    return 0;
}